import { defHttp } from '@/utils/http/axios';

enum Api {
  AccountList = '/admin/user',
  DeptList = '/system/getDeptList',
  MenuList = '/common/admin/menus',
  RolePageList = '/system/getRoleListByPage',
}

export const getAccountList = (params) => {
  const {page = 1, pageSize = 20, search = ''} = params;
  return defHttp.get({url: `${Api.AccountList}/${page}/${pageSize}${search ? '?' + search : ''}`});
}

export const getDeptList = (params) =>
  defHttp.get({ url: Api.DeptList, params });

export const getMenuList = (params) =>
  defHttp.get({ url: Api.MenuList, params });

export const getRoleListByPage = (params) =>
  defHttp.get({ url: Api.RolePageList, params });
